package com.lap.auth.application.menu.command;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

@Data
@Schema(description = "更新菜单命令")
public class UpdateMenuCmd {

  @Schema(description = "父ID集合")
  private List<Integer> pidPaths;

  @NotNull(message = "{menu.type.required}")
  @Range(min = -128, max = 128, message = "{menu.type.range}")
  @Schema(description = "菜单类型")
  private Integer type;

  @Length(max = 128, message = "{menu.path.max.length}")
  @Schema(description = "菜单路径")
  private String path;

  @NotEmpty(message = "{menu.name.required}")
  @Length(max = 64, message = "{menu.name.max.length}")
  @Schema(description = "菜单名称")
  private String name;

  @Length(max = 128, message = "{menu.component.max.length}")
  @Schema(description = "菜单组件路径")
  private String component;

  @Length(max = 256, message = "{menu.redirect.max.length}")
  @Schema(description = "重新定向路径")
  private String redirect;

  @Length(max = 128, message = "{menu.link.max.length}")
  @Schema(description = "外链/内链")
  private String link;

  @Length(max = 128, message = "{menu.permCode.max.length}")
  @Schema(description = "功能权限码")
  private String permCode;

  @NotNull(message = "{menu.sortOrder.required}")
  @Min(value = -128, message = "{menu.sortOrder.min}")
  @Max(value = 127, message = "{menu.sortOrder.max}")
  @Schema(description = "排序")
  private Integer sortOrder;

  @Valid
  @Schema(description = "元件")
  private MetaCmd meta;
}
